package edu.nf.ch08;

/**
 * @author wangl
 * @date 2025/4/17
 * 懒汉式(注意线程安全的问题)
 */
public class Student {

    private static Student instance;


    private Student(){}
    /**
     * 当调用get方法时初始化实例并返回
     * @return
     */
    public static synchronized Student getInstance() {
        if(instance == null) {
            instance = new Student();
        }
        return instance;
    }
}